<!DOCTYPE html>
<html lang="en">
<head>
	<meta content="width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
	<meta name="apple-mobile-web-app-capable" content="no" />
	<link rel="shortcut icon" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/img/logo.png"/>
	<meta charset="UTF-8">
	<title>{{.title}}</title>
	<style type="text/css"></style>
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/css/mui.min.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/addsite.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/css/other/all.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/Css/SUI.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/Font/iconfont.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/css/mobileSelect.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/css/mui.picker.css">
	<link rel="stylesheet" type="text/css" href="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/css/mui.poppicker.css">
</head>
<style>
	input{margin: 0 !important;border: none !important; padding: 0 !important;height: 21px !important;text-align: right}
	p{padding: 10px}
	.suiLineInput{background-color: #fff;}
	.suiLineInput dl{padding: 10px 10px 10px 0;margin-left: 10px;display: flex;align-items: center;font-size: 14px;border-bottom: 1px solid #eee}
	.suiLineInput dl dt{flex-shrink: 0;margin-right: 10px}
	.suiLineInput dl dd{flex-grow: 1;text-align: right;font-size: 14px}
	.suiLineInput dl:last-of-type{display: block;}
	.suiLineInput dl:last-of-type dt{margin-bottom: 3px}

	
</style>
<body>
	<p class="suiTag top10">收货信息</p>
	<form id="form">	
		<div class="suiLineInput">
			<dl>
				<dt>姓名</dt>
				<dd><input name="name" type="text" placeholder="请输入收货人姓名" value="{{.info.name}}"></dd>
			</dl>
			<dl>
				<dt>手机</dt>
				<dd><input type="number" pattern="[0-9]" placeholder="请输入收货人手机号码" name="mobile" value="{{.info.mobile}}"></dd>
			</dl>
			<dl>
				<dt>所在地区</dt>
				<dd class="address" id="address" style="color: #979797">{{if .info.shen}}{{.info.shen}} {{.info.shi}} {{.info.qu}}{{else}}请选择所在地区{{end}}</dd>
			</dl>
			<input type="hidden" name="province" value="{{.info.province}}" id="province">
			<input type="hidden" name="city" value="{{.info.city}}" id="city">
			<input type="hidden" name="area" value="{{.info.area}}" id="area">
			<input type="hidden" name="id" value="{{.info.id}}">
			<dl>
				<dt>所在详细地址地区</dt>
				<dd><input type="text" placeholder="请输入详细地址" name="address" value="{{.info.address}}"></dd>
			</dl>
		</div>
	</form>
	<button id="up" style="background-color: #fedb4d; background-image: -webkit-linear-gradient(left,#f46f6f,#e54242); width: 92%; box-shadow: 0 2px 5px rgba(229,66,66,.5); height: 40px; color: #fff; border-radius: 5px; font-weight: 400; font-size: 1pc; letter-spacing: 3px; display: block; margin: auto; margin-top: 20px; margin-bottom: 20px;">确定</button>
</body>
<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/sui/Js/SUI.js"></script>
<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/js/mui.min.js"></script>
<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/js/mui.picker.min.js"></script>
<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/js/mui.poppicker.js"></script>
<script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/frame/mui/js/city.data-3.js"></script>
{{template "wechat/public/share.html" .}}
<!-- <script type="text/javascript" src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/wechat/js/addsite.js"></script> -->
<script>
	var cityPicker3 = new mui.PopPicker({
	    layer: 3
	});
	cityPicker3.setData(cityData3);
	var showCityPickerButton = document.getElementById('address');
	showCityPickerButton.addEventListener('tap', function(event) {
    cityPicker3.show(function(items) {
        showCityPickerButton.innerHTML =items[0].text +" "+ items[1].text +" "+items[2].text 
        document.getElementById('province').setAttribute("value",items[0].value)
        document.getElementById('city').setAttribute("value",items[1].value)
        document.getElementById('area').setAttribute("value",items[2].value)
    });
}, false);
function serialize(form){
 var form=document.getElementById(form);
 var arr={};
	for (var i = 0; i < form.elements.length; i++) {
		    var feled=form.elements[i];
		    switch(feled.type) {
		    case undefined:
		    case 'button':
		    case 'file':
		    case 'reset':
		    case 'submit':
		    break;
		    case 'checkbox':
		    case 'radio':
		    if (!feled.checked) {
		    	break;
		    }
		    default:
		    if (arr[feled.name]) {
			    arr[feled.name]=arr[feled.name]+','+feled.value;
		    }else{
			    arr[feled.name]=feled.value;
		    } 
	    }
 	}
 	return arr
 }
document.getElementById("up").addEventListener("tap", function(){
	var info=serialize('form')
	if (!info.name){
	    mui.toast('请输入姓名!')
	    return false
	}
	if (!info.mobile){
	    mui.toast('请输入手机号码!')
	    return false
	}
	if (!info.province){
	    mui.toast('请选择地区!')
	    return false
	}
	if (!info.address){
	    mui.toast('请输入详细地址!')
	    return false
	}
	var that=this
	that.disabled=true
	mui.ajax(window.location.href,{
		data:info,
		type:'post',
		timeout:10000,
		success:function(data){
			if(data==1){
	        mui.alert("","保存成功","确定",function(){
	            window.location.href=document.referrer
	        })
	       }else{
	        mui.alert("网络繁忙,请重试")
	       }
	       that.disabled=false
		},error:function(){
			mui.alert("网络繁忙,请重试")
			that.disabled=false
		}
	}) 
});
</script>
</html>